home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / perlman / man / perlvar.txt < prev    next >
Encoding:
Text File  |  1999-09-09  |  25.9 KB  |  677 lines

  1. NAME
  2.        perlvar - Perl predefined variables
  3.  
  4. DESCRIPTION
  5.        Predefined Names
  6.  
  7.        The following names have special meaning to Perl.  Most of
  8.        the punctuational names have reasonable mnemonics, or
  9.        analogues in one of the shells.  Nevertheless, if you wish
  10.        to use the long variable names, you just need to say
  11.  
  12.            use English;
  13.  
  14.        at the top of your program.  This will alias all the short
  15.        names to the long names in the current package.  Some of
  16.        them even have medium names, generally borrowed from awk.
  17.  
  18.        To go a step further, those variables that depend on the
  19.        currently selected filehandle may instead be set by
  20.        calling an object method on the FileHandle object.
  21.        (Summary lines below for this contain the word HANDLE.)
  22.        First you must say
  23.  
  24.            use FileHandle;
  25.  
  26.        after which you may use either
  27.  
  28.            method HANDLE EXPR
  29.  
  30.        or
  31.  
  32.            HANDLE->method(EXPR)
  33.  
  34.        Each of the methods returns the old value of the
  35.        FileHandle attribute.  The methods each take an optional
  36.        EXPR, which if supplied specifies the new value for the
  37.        FileHandle attribute in question.  If not supplied, most
  38.        of the methods do nothing to the current value, except for
  39.        autoflush(), which will assume a 1 for you, just to be
  40.        different.
  41.  
  42.        A few of these variables are considered "read-only".  This
  43.        means that if you try to assign to this variable, either
  44.        directly or indirectly through a reference, you'll raise a
  45.        run-time exception.
  46.  
  47.        $ARG
  48.  
  49.        $_      The default input and pattern-searching space.
  50.                The following pairs are equivalent:
  51.  
  52.                    while (<>) {...}    # only equivalent in while!
  53.                    while ($_ = <>) {...}
  54.  
  55.                    /^Subject:/
  56.                    $_ =~ /^Subject:/
  57.  
  58.                    tr/a-z/A-Z/
  59.                    $_ =~ tr/a-z/A-Z/
  60.  
  61.                    chop
  62.                    chop($_)
  63.  
  64.                Here are the places where Perl will assume $_ even
  65.                if you don't use it:
  66.  
  67.        o          Various unary functions, including functions
  68.                   like ord() and int(), as well as the all file
  69.                   tests (-f, -d) except for -t, which defaults to
  70.                   STDIN.
  71.  
  72.        o          Various list functions like print() and
  73.                   unlink().
  74.  
  75.        o          The pattern matching operations m//, s///, and
  76.                   tr/// when used without an =~ operator.
  77.  
  78.        o          The default iterator variable in a foreach loop
  79.                   if no other variable is supplied.
  80.  
  81.        o          The implicit iterator variable in the grep()
  82.                   and map() functions.
  83.  
  84.        o          The default place to put an input record when a
  85.                   <FH> operation's result is tested by itself as
  86.                   the sole criterion of a while test.  Note that
  87.                   outside of a while test, this will not happen.
  88.  
  89.                   (Mnemonic: underline is understood in certain
  90.                   operations.)
  91.  
  92.        $<digit>
  93.                Contains the subpattern from the corresponding set
  94.                of parentheses in the last pattern matched, not
  95.                counting patterns matched in nested blocks that
  96.                have been exited already.  (Mnemonic: like
  97.                \digit.)  These variables are all read-only.
  98.  
  99.        $MATCH
  100.  
  101.        $&      The string matched by the last successful pattern
  102.                match (not counting any matches hidden within a
  103.                BLOCK or eval() enclosed by the current BLOCK).
  104.                (Mnemonic: like & in some editors.)  This variable
  105.                is read-only.
  106.  
  107.        $PREMATCH
  108.  
  109.        $`      The string preceding whatever was matched by the
  110.                last successful pattern match (not counting any
  111.                matches hidden within a BLOCK or eval enclosed by
  112.                the current BLOCK).  (Mnemonic: ` often precedes a
  113.                quoted string.)  This variable is read-only.
  114.  
  115.        $POSTMATCH
  116.  
  117.        $'      The string following whatever was matched by the
  118.                last successful pattern match (not counting any
  119.                matches hidden within a BLOCK or eval() enclosed
  120.                by the current BLOCK).  (Mnemonic: ' often follows
  121.                a quoted string.)  Example:
  122.  
  123.                    $_ = 'abcdefghi';
  124.                    /def/;
  125.                    print "$`:$&:$'\n";         # prints abc:def:ghi
  126.  
  127.                This variable is read-only.
  128.  
  129.        $LAST_PAREN_MATCH
  130.  
  131.        $+      The last bracket matched by the last search
  132.                pattern.  This is useful if you don't know which
  133.                of a set of alternative patterns matched.  For
  134.                example:
  135.  
  136.                    /Version: (.*)|Revision: (.*)/ && ($rev = $+);
  137.  
  138.                (Mnemonic: be positive and forward looking.)  This
  139.                variable is read-only.
  140.  
  141.        $MULTILINE_MATCHING
  142.  
  143.        $*      Set to 1 to do multiline matching within a string,
  144.                0 to tell Perl that it can assume that strings
  145.                contain a single line, for the purpose of
  146.                optimizing pattern matches.  Pattern matches on
  147.                strings containing multiple newlines can produce
  148.                confusing results when "$*" is 0.  Default is 0.
  149.                (Mnemonic: * matches multiple things.)  Note that
  150.                this variable only influences the interpretation
  151.                of "^" and "$".  A literal newline can be searched
  152.                for even when $* == 0.
  153.  
  154.                Use of "$*" is deprecated in Perl 5.
  155.  
  156.        input_line_number HANDLE EXPR
  157.  
  158.        $INPUT_LINE_NUMBER
  159.  
  160.        $NR
  161.  
  162.        $.      The current input line number of the last
  163.                filehandle that was read.  An explicit close on
  164.                the filehandle resets the line number.  Since "<>"
  165.                never does an explicit close, line numbers
  166.                increase across ARGV files (but see examples under
  167.                eof()).  Localizing $. has the effect of also
  168.                localizing Perl's notion of "the last read
  169.                filehandle".  (Mnemonic: many programs use "." to
  170.                mean the current line number.)
  171.  
  172.        input_record_separator HANDLE EXPR
  173.  
  174.        $INPUT_RECORD_SEPARATOR
  175.  
  176.        $RS
  177.  
  178.        $/      The input record separator, newline by default.
  179.                Works like awk's RS variable, including treating
  180.                blank lines as delimiters if set to the null
  181.                string.  You may set it to a multicharacter string
  182.                to match a multi-character delimiter.  Note that
  183.                setting it to "\n\n" means something slightly
  184.                different than setting it to "", if the file
  185.                contains consecutive blank lines.  Setting it to
  186.                "" will treat two or more consecutive blank lines
  187.                as a single blank line.  Setting it to "\n\n" will
  188.                blindly assume that the next input character
  189.                belongs to the next paragraph, even if it's a
  190.                newline.  (Mnemonic: / is used to delimit line
  191.                boundaries when quoting poetry.)
  192.  
  193.                    undef $/;
  194.                    $_ = <FH>;          # whole file now here
  195.                    s/\n[ \t]+/ /g;
  196.  
  197.        autoflush HANDLE EXPR
  198.  
  199.        $OUTPUT_AUTOFLUSH
  200.  
  201.        $|      If set to nonzero, forces a flush after every
  202.                write or print on the currently selected output
  203.                channel.  Default is 0.  Note that STDOUT will
  204.                typically be line buffered if output is to the
  205.                terminal and block buffered otherwise.  Setting
  206.                this variable is useful primarily when you are
  207.                outputting to a pipe, such as when you are running
  208.                a Perl script under rsh and want to see the output
  209.                as it's happening.  This has no effect on input
  210.                buffering.  (Mnemonic: when you want your pipes to
  211.                be piping hot.)
  212.  
  213.        output_field_separator HANDLE EXPR
  214.  
  215.        $OUTPUT_FIELD_SEPARATOR
  216.  
  217.        $OFS
  218.  
  219.        $,      The output field separator for the print operator.
  220.                Ordinarily the print operator simply prints out
  221.                the comma separated fields you specify.  In order
  222.                to get behavior more like awk, set this variable
  223.                as you would set awk's OFS variable to specify
  224.                what is printed between fields.  (Mnemonic: what
  225.                is printed when there is a , in your print
  226.                statement.)
  227.  
  228.        output_record_separator HANDLE EXPR
  229.  
  230.        $OUTPUT_RECORD_SEPARATOR
  231.  
  232.        $ORS
  233.  
  234.        $\      The output record separator for the print
  235.                operator.  Ordinarily the print operator simply
  236.                prints out the comma separated fields you specify,
  237.                with no trailing newline or record separator
  238.                assumed.  In order to get behavior more like awk,
  239.                set this variable as you would set awk's ORS
  240.                variable to specify what is printed at the end of
  241.                the print.  (Mnemonic: you set "$\" instead of
  242.                adding \n at the end of the print.  Also, it's
  243.                just like /, but it's what you get "back" from
  244.                Perl.)
  245.  
  246.        $LIST_SEPARATOR
  247.  
  248.        $"      This is like "$," except that it applies to array
  249.                values interpolated into a double-quoted string
  250.                (or similar interpreted string).  Default is a
  251.                space.  (Mnemonic: obvious, I think.)
  252.  
  253.        $SUBSCRIPT_SEPARATOR
  254.  
  255.        $SUBSEP
  256.  
  257.        $;      The subscript separator for multi-dimensional
  258.                array emulation.  If you refer to a hash element
  259.                as
  260.  
  261.                    $foo{$a,$b,$c}
  262.  
  263.                it really means
  264.  
  265.                    $foo{join($;, $a, $b, $c)}
  266.  
  267.                But don't put
  268.  
  269.                    @foo{$a,$b,$c}      # a slice--note the @
  270.  
  271.                which means
  272.  
  273.                    ($foo{$a},$foo{$b},$foo{$c})
  274.  
  275.                Default is "\034", the same as SUBSEP in awk.
  276.                Note that if your keys contain binary data there
  277.                might not be any safe value for "$;".  (Mnemonic:
  278.                comma (the syntactic subscript separator) is a
  279.                semi-semicolon.  Yeah, I know, it's pretty lame,
  280.                but "$," is already taken for something more
  281.                important.)
  282.  
  283.                Consider using "real" multi-dimensional arrays in
  284.                Perl 5.
  285.  
  286.        $OFMT
  287.  
  288.        $#      The output format for printed numbers.  This
  289.                variable is a half-hearted attempt to emulate
  290.                awk's OFMT variable.  There are times, however,
  291.                when awk and Perl have differing notions of what
  292.                is in fact numeric.  Also, the initial value is
  293.                %.20g rather than %.6g, so you need to set "$#"
  294.                explicitly to get awk's value.  (Mnemonic: # is
  295.                the number sign.)
  296.  
  297.                Use of "$#" is deprecated in Perl 5.
  298.  
  299.        format_page_number HANDLE EXPR
  300.  
  301.        $FORMAT_PAGE_NUMBER
  302.  
  303.        $%      The current page number of the currently selected
  304.                output channel.  (Mnemonic: % is page number in
  305.                nroff.)
  306.  
  307.        format_lines_per_page HANDLE EXPR
  308.  
  309.        $FORMAT_LINES_PER_PAGE
  310.  
  311.        $=      The current page length (printable lines) of the
  312.                currently selected output channel.  Default is 60.
  313.                (Mnemonic: = has horizontal lines.)
  314.  
  315.        format_lines_left HANDLE EXPR
  316.  
  317.        $FORMAT_LINES_LEFT
  318.  
  319.        $-      The number of lines left on the page of the
  320.                currently selected output channel.  (Mnemonic:
  321.                lines_on_page - lines_printed.)
  322.  
  323.        format_name HANDLE EXPR
  324.  
  325.        $FORMAT_NAME
  326.  
  327.        $~      The name of the current report format for the
  328.                currently selected output channel.  Default is
  329.                name of the filehandle.  (Mnemonic: brother to
  330.                "$^".)
  331.  
  332.        format_top_name HANDLE EXPR
  333.  
  334.        $FORMAT_TOP_NAME
  335.  
  336.        $^      The name of the current top-of-page format for the
  337.                currently selected output channel.  Default is
  338.                name of the filehandle with _TOP appended.
  339.                (Mnemonic: points to top of page.)
  340.  
  341.        format_line_break_characters HANDLE EXPR
  342.  
  343.        $FORMAT_LINE_BREAK_CHARACTERS
  344.  
  345.        $:      The current set of characters after which a string
  346.                may be broken to fill continuation fields
  347.                (starting with ^) in a format.  Default is " \n-",
  348.                to break on whitespace or hyphens.  (Mnemonic: a
  349.                "colon" in poetry is a part of a line.)
  350.  
  351.        format_formfeed HANDLE EXPR
  352.  
  353.        $FORMAT_FORMFEED
  354.  
  355.        $^L     What formats output to perform a formfeed.
  356.                Default is \f.
  357.  
  358.        $ACCUMULATOR
  359.  
  360.        $^A     The current value of the write() accumulator for
  361.                format() lines.  A format contains formline()
  362.                commands that put their result into $^A.  After
  363.                calling its format, write() prints out the
  364.                contents of $^A and empties.  So you never
  365.                actually see the contents of $^A unless you call
  366.                formline() yourself and then look at it.  See the
  367.                perlform manpage and the formline() entry in the
  368.                perlfunc manpage.
  369.  
  370.        $CHILD_ERROR
  371.  
  372.        $?      The status returned by the last pipe close,
  373.                backtick (``) command, or system() operator.  Note
  374.                that this is the status word returned by the
  375.                wait() system call, so the exit value of the
  376.                subprocess is actually ($? >> 8).  Thus on many
  377.                systems, $? & 255 gives which signal, if any, the
  378.                process died from, and whether there was a core
  379.                dump.  (Mnemonic: similar to sh and ksh.)
  380.  
  381.        $OS_ERROR
  382.  
  383.        $ERRNO
  384.  
  385.        $!      If used in a numeric context, yields the current
  386.                value of errno, with all the usual caveats.  (This
  387.                means that you shouldn't depend on the value of
  388.                "$!" to be anything in particular unless you've
  389.                gotten a specific error return indicating a system
  390.                error.)  If used in a string context, yields the
  391.                corresponding system error string.  You can assign
  392.                to "$!" in order to set errno if, for instance,
  393.                you want "$!" to return the string for error n, or
  394.                you want to set the exit value for the die()
  395.                operator.  (Mnemonic: What just went bang?)
  396.  
  397.        $EXTENDED_OS_ERROR
  398.  
  399.        $^E     More specific information about the last system
  400.                error than that provided by $!, if available.  (If
  401.                not, it's just $! again.)  At the moment, this
  402.                differs from $! only under VMS, where it provides
  403.                the VMS status value from the last system error.
  404.                The caveats mentioned in the description of $!
  405.                apply here, too.  (Mnemonic: Extra error
  406.                explanation.)
  407.  
  408.        $EVAL_ERROR
  409.  
  410.        $@      The Perl syntax error message from the last eval()
  411.                command.  If null, the last eval() parsed and
  412.                executed correctly (although the operations you
  413.                invoked may have failed in the normal fashion).
  414.                (Mnemonic: Where was the syntax error "at"?)
  415.  
  416.                Note that warning messages are not collected in
  417.                this variable.  You can, however, set up a routine
  418.                to process warnings by setting $SIG{__WARN__}
  419.                below.
  420.  
  421.        $PROCESS_ID
  422.  
  423.        $PID
  424.  
  425.        $$      The process number of the Perl running this
  426.                script.  (Mnemonic: same as shells.)
  427.  
  428.        $REAL_USER_ID
  429.  
  430.        $UID
  431.  
  432.        $<      The real uid of this process.  (Mnemonic: it's the
  433.                uid you came FROM, if you're running setuid.)
  434.  
  435.        $EFFECTIVE_USER_ID
  436.  
  437.        $EUID
  438.  
  439.        $>      The effective uid of this process.  Example:
  440.  
  441.                    $< = $>;            # set real to effective uid
  442.                    ($<,$>) = ($>,$<);  # swap real and effective uid
  443.  
  444.                (Mnemonic: it's the uid you went TO, if you're
  445.                running setuid.)  Note: "$<" and "$>" can only be
  446.                swapped on machines supporting setreuid().
  447.  
  448.        $REAL_GROUP_ID
  449.  
  450.        $GID
  451.  
  452.        $(      The real gid of this process.  If you are on a
  453.                machine that supports membership in multiple
  454.                groups simultaneously, gives a space separated
  455.                list of groups you are in.  The first number is
  456.                the one returned by getgid(), and the subsequent
  457.                ones by getgroups(), one of which may be the same
  458.                as the first number.  (Mnemonic: parentheses are
  459.                used to GROUP things.  The real gid is the group
  460.                you LEFT, if you're running setgid.)
  461.  
  462.        $EFFECTIVE_GROUP_ID
  463.  
  464.        $EGID
  465.  
  466.        $)      The effective gid of this process.  If you are on
  467.                a machine that supports membership in multiple
  468.                groups simultaneously, gives a space separated
  469.                list of groups you are in.  The first number is
  470.                the one returned by getegid(), and the subsequent
  471.                ones by getgroups(), one of which may be the same
  472.                as the first number.  (Mnemonic: parentheses are
  473.                used to GROUP things.  The effective gid is the
  474.                group that's RIGHT for you, if you're running
  475.                setgid.)
  476.  
  477.                Note: "$<", "$>", "$(" and "$)" can only be set on
  478.                machines that support the corresponding
  479.                set[re][ug]id() routine.  "$(" and "$)" can only
  480.                be swapped on machines supporting setregid().
  481.                Because Perl doesn't currently use initgroups(),
  482.                you can't set your group vector to multiple
  483.                groups.
  484.        $PROGRAM_NAME
  485.  
  486.        $0      Contains the name of the file containing the Perl
  487.                script being executed.  Assigning to "$0" modifies
  488.                the argument area that the ps(1) program sees.
  489.                This is more useful as a way of indicating the
  490.                current program state than it is for hiding the
  491.                program you're running.  (Mnemonic: same as sh and
  492.                ksh.)
  493.  
  494.        $[      The index of the first element in an array, and of
  495.                the first character in a substring.  Default is 0,
  496.                but you could set it to 1 to make Perl behave more
  497.                like awk (or Fortran) when subscripting and when
  498.                evaluating the index() and substr() functions.
  499.                (Mnemonic: [ begins subscripts.)
  500.  
  501.                As of Perl 5, assignment to "$[" is treated as a
  502.                compiler directive, and cannot influence the
  503.                behavior of any other file.  Its use is
  504.                discouraged.
  505.  
  506.        $PERL_VERSION
  507.  
  508.        $]      The string printed out when you say perl -v.
  509.                (This is currently BROKEN).  It can be used to
  510.                determine at the beginning of a script whether the
  511.                perl interpreter executing the script is in the
  512.                right range of versions.  If used in a numeric
  513.                context, returns the version + patchlevel / 1000.
  514.                Example:
  515.  
  516.                    # see if getc is available
  517.                    ($version,$patchlevel) =
  518.                             $] =~ /(\d+\.\d+).*\nPatch level: (\d+)/;
  519.                    print STDERR "(No filename completion available.)\n"
  520.                             if $version * 1000 + $patchlevel < 2016;
  521.  
  522.                or, used numerically,
  523.  
  524.                    warn "No checksumming!\n" if $] < 3.019;
  525.  
  526.                (Mnemonic: Is this version of perl in the right
  527.                bracket?)
  528.  
  529.        $DEBUGGING
  530.  
  531.        $^D     The current value of the debugging flags.
  532.                (Mnemonic: value of -D switch.)
  533.  
  534.        $SYSTEM_FD_MAX
  535.  
  536.        $^F     The maximum system file descriptor, ordinarily 2.
  537.                System file descriptors are passed to exec()ed
  538.                processes, while higher file descriptors are not.
  539.                Also, during an open(), system file descriptors
  540.                are preserved even if the open() fails.  (Ordinary
  541.                file descriptors are closed before the open() is
  542.                attempted.)  Note that the close-on-exec status of
  543.                a file descriptor will be decided according to the
  544.                value of $^F at the time of the open, not the time
  545.                of the exec.
  546.  
  547.        $INPLACE_EDIT
  548.  
  549.        $^I     The current value of the inplace-edit extension.
  550.                Use undef to disable inplace editing.  (Mnemonic:
  551.                value of -i switch.)
  552.  
  553.        $OSNAME =item $^O
  554.                The name of the operating system under which this
  555.                copy of Perl was built, as determined during the
  556.                configuration process.  The value is identical to
  557.                $Config{'osname'}.
  558.  
  559.        $PERLDB
  560.  
  561.        $^P     The internal flag that the debugger clears so that
  562.                it doesn't debug itself.  You could conceivably
  563.                disable debugging yourself by clearing it.
  564.  
  565.        $BASETIME
  566.  
  567.        $^T     The time at which the script began running, in
  568.                seconds since the epoch (beginning of 1970).  The
  569.                values returned by the -M, -A and -C filetests are
  570.                based on this value.
  571.  
  572.        $WARNING
  573.  
  574.        $^W     The current value of the warning switch, either
  575.                TRUE or FALSE.  (Mnemonic: related to the -w
  576.                switch.)
  577.  
  578.        $EXECUTABLE_NAME
  579.  
  580.        $^X     The name that the Perl binary itself was executed
  581.                as, from C's argv[0].
  582.  
  583.        $ARGV   contains the name of the current file when reading
  584.                from <>.
  585.  
  586.        @ARGV   The array @ARGV contains the command line
  587.                arguments intended for the script.  Note that
  588.                $#ARGV is the generally number of arguments minus
  589.                one, since $ARGV[0] is the first argument, NOT the
  590.                command name.  See "$0" for the command name.
  591.  
  592.        @INC    The array @INC contains the list of places to look
  593.                for Perl scripts to be evaluated by the do EXPR,
  594.                require, or use constructs.  It initially consists
  595.                of the arguments to any -I command line switches,
  596.                followed by the default Perl library, probably
  597.                "/usr/local/lib/perl", followed by ".", to
  598.                represent the current directory.  If you need to
  599.                modify this at runtime, you should use the use lib
  600.                pragma in order to also get the machine-dependent
  601.                library properly loaded:
  602.  
  603.                    use lib '/mypath/libdir/';
  604.                    use SomeMod;
  605.  
  606.                =item %INC
  607.  
  608.                The hash %INC contains entries for each filename
  609.                that has been included via do or require.  The key
  610.                is the filename you specified, and the value is
  611.                the location of the file actually found.  The
  612.                require command uses this array to determine
  613.                whether a given file has already been included.
  614.  
  615.        $ENV{expr}
  616.                The hash %ENV contains your current environment.
  617.                Setting a value in ENV changes the environment for
  618.                child processes.
  619.  
  620.        $SIG{expr}
  621.                The hash %SIG is used to set signal handlers for
  622.                various signals.  Example:
  623.  
  624.                    sub handler {       # 1st argument is signal name
  625.                        local($sig) = @_;
  626.                        print "Caught a SIG$sig--shutting down\n";
  627.                        close(LOG);
  628.                        exit(0);
  629.                    }
  630.  
  631.                    $SIG{'INT'} = 'handler';
  632.                    $SIG{'QUIT'} = 'handler';
  633.                    ...
  634.                    $SIG{'INT'} = 'DEFAULT';    # restore default action
  635.                    $SIG{'QUIT'} = 'IGNORE';    # ignore SIGQUIT
  636.  
  637.                The %SIG array only contains values for the
  638.                signals actually set within the Perl script.  Here
  639.                are some other examples:
  640.  
  641.                    $SIG{PIPE} = Plumber;       # SCARY!!
  642.                    $SIG{"PIPE"} = "Plumber";   # just fine, assumes main::Plumber
  643.                    $SIG{"PIPE"} = \&Plumber;   # just fine; assume current Plumber
  644.                    $SIG{"PIPE"} = Plumber();   # oops, what did Plumber() return??
  645.  
  646.                The one marked scary is problematic because it's a
  647.                bareword, which means sometimes it's a string
  648.                representing the function, and sometimes it's
  649.                going to call the subroutine call right then and
  650.                there!  Best to be sure and quote it or take a
  651.                reference to it.  *Plumber works too.  See the
  652.                perlsubs manpage.
  653.  
  654.                Certain internal hooks can be also set using the
  655.                %SIG hash.  The routine indicated by
  656.                $SIG{__WARN__} is called when a warning message is
  657.                about to be printed.  The warning message is
  658.                passed as the first argument.  The presence of a
  659.                __WARN__ hook causes the ordinary printing of
  660.                warnings to STDERR to be suppressed.  You can use
  661.                this to save warnings in a variable, or turn
  662.                warnings into fatal errors, like this:
  663.  
  664.                    local $SIG{__WARN__} = sub { die $_[0] };
  665.                    eval $proggie;
  666.  
  667.                The routine indicated by $SIG{__DIE__} is called
  668.                when a fatal exception is about to be thrown.  The
  669.                error message is passed as the first argument.
  670.                When a __DIE__ hook routine returns, the exception
  671.                processing continues as it would have in the
  672.                absence of the hook, unless the hook routine
  673.                itself exits via a goto, a loop exit, or a die().
  674.                The __DIE__ handler is explicitly disabled during
  675.                the call, so that you can die from a __DIE__
  676.                handler.  Similarly for __WARN__.
  677.